#ifndef __BSP_USART_H_
#define __BSP_USART_H_
#include "gd32f3x0.h"

#define RX_BUFFER_MAX 128
#define TX_BUFFER_MAX 128

#define TX_STR "\n\rUSART DMA receive and transmit example, please input 10 bytes:\n\r"

#define ARRAYNUM(arr_nanme)      (uint32_t)(sizeof(arr_nanme) / sizeof(*(arr_nanme)))

void usart0_gpio_config(void);
void usart0_config(void);
void usart1_gpio_config(void);
void usart1_config(void);
int usart_dma_rx_init(uint8_t *buff, uint16_t buff_len);
int usart_dma_tx_init(uint8_t *buff, uint16_t buff_len);

uint8_t usart_dma_recv(uint32_t usart, uint8_t *buffer, uint16_t buf_len);
int usart_dma_send(uint32_t usart, uint8_t *buffer, uint16_t buf_len);
#endif
